import { defineAsyncComponent } from 'vue'
export default {
  install(app: any) {
    const requireModules = import.meta.glob('../components/*.vue')
    for (const path in requireModules) {
      const result: RegExpMatchArray = path.match(
        /.*\/(.+).vue$/
      ) as RegExpMatchArray
      const modules: any = requireModules[path]
      app.component(result[1], defineAsyncComponent(modules))
    }
  },
}
